﻿//8. Write a program that shows the binary representation of given 16-bit signed integer number (the C# type short).


using System;
using System.Collections.Generic;

class ShortToBinary
{
    static void Main()
    {
        short shortNumber = short.Parse(Console.ReadLine());
        Console.WriteLine(GetShortBinaryString(shortNumber));
        Console.WriteLine(Convert.ToString(shortNumber, 2));
    }

    static string GetShortBinaryString(short shortNumber)
    {
        string binarynumber = String.Empty;
        int remainder = 0;

        if (shortNumber >= 0)
        {
            while (shortNumber > 0)
            {
                remainder = shortNumber % 2;
                shortNumber /= 2;
                binarynumber = remainder + binarynumber;
            }
        }
        else
        {
            shortNumber = (short)(-1 * (shortNumber + 1));

            while (binarynumber.Length < 16)
            {
                remainder = shortNumber % 2;
                shortNumber /= 2;
                if (remainder == 1)
                {
                    remainder = 0;
                }
                else
                {
                    remainder = 1;
                }
                binarynumber = remainder + binarynumber;
            }
        }
        return binarynumber;
    }

}
